
var address = function(json){console.log(json)
		var addressInit = function(_cmbProvince, _cmbCity, _cmbArea, _cmbStreet, defaultProvince, defaultCity, defaultArea,defaultStreet)
		{    
   			 var cmbProvince = document.getElementById(_cmbProvince); 
    		var cmbCity = document.getElementById(_cmbCity);    
    		var cmbArea = document.getElementById(_cmbArea);   
    		var cmbStreet = document.getElementById(_cmbStreet);  
    		function cmbSelect(cmb,val)    
    		{    
        		for(var i=0; i<cmb.options.length; i++)    
       			 {    
           			 if(cmb.options[i].var == val)    
           			 {    
             			   cmb.selectedIndex = i;
               			 return;    
          			  }    
       			 }    
  			  }    
  			function cmbAddOption(cmb, str, val,obj)    
    		{    
       			 var option = document.createElement("OPTION");    
       			 cmb.options.add(option);    
        		 option.innerText = str;    
        		 option.value = val;    
       			 option.obj = obj;    
   			 }    

  		    function changeCity()    
    		{  
        		cmbArea.options.length = 0;  
        		if(cmbCity.selectedIndex == -1)return; 
        		var item =1
        		var item= cmbCity.options[cmbCity.selectedIndex].obj;
//      		console.log(item)
        		if(!item.length){   //判断是否为一个数据
        			cmbAddOption(cmbArea, item.text,item.value, item.children);}else{
        		for(var i=0; i<item.length; i++)    
        		{    
            		cmbAddOption(cmbArea, item[i].text,item[i].value, null);    
        		}  
        		}
        		cmbSelect(cmbArea, defaultArea);    
    		}    
    		function changeProvince()    
    		{    
        		cmbCity.options.length = 0;    
        		cmbCity.onchange = null;    
        		if(cmbProvince.selectedIndex == -1)return;    
        		var item=1;
        		 item= cmbProvince.options[cmbProvince.selectedIndex].obj;
//      		console.log(item);
        		if(!item.length){        ///判断是否为一个数据
        			cmbAddOption(cmbCity, item.text,item.value, item.children);}else{
        		for(var i=0; i<item.length; i++)    
        		{    
            		cmbAddOption(cmbCity, item[i].text,item[i].value, item[i].children);    
        		}   
        		}
        		cmbSelect(cmbCity, defaultCity);    
        		changeCity();    
        		cmbCity.onchange = changeCity;   

    		}    
        
    		for(var i=0; i<json.length; i++)    
    		{    
        		cmbAddOption(cmbProvince, json[i].text, json[i].value,json[i].children);    
    		}    
    		cmbSelect(cmbProvince, defaultProvince);    
    		changeProvince();    
    		cmbProvince.onchange = changeProvince;    
		}
		addressInit('cmbProvince', 'cmbCity', 'cmbArea')
	}
	
//var renming=function(json){}







//var host_InterfaceJson="http://www.zhongxinduan.com/EduPlate/MobileManageCenter/InterfaceJson.asmx";
//$host_BasePlate="http://114.80.111.137:8041/BasePlate/Interface/IInterfaceJson.asmx";
//$.ajax(host_InterfaceJson+'/Area_GetXD3', {          //34
//	dataType:"jsonp",
//	data: {
//		App_ID: 1,
//		jsonpCallback:'success_jsonpCallback1'
//	},
//	success: function(json){
//		console.log(json)
//		
//	},
//	jsonpCallback: 'success_jsonpCallback1'
//	
//});
//http://www.zhongxinduan.com/EduPlate/MobileManageCenter/InterfaceJson.asmx
 $.ajax(API.baseUrl+'/EduPlate/MobileManageCenter/InterfaceJson.asmx/Area_GetListHot',{        //热门区域赋值
	dataType:"json",
	data: {
		App_ID:1,
//		jsonpCallback:'success_jsonpCallback'
	},
	success:function(json){
		console.log(json.Goodo.R.length)
		console.log(json.Goodo.R[0].AreaName)
		if(json.Goodo.R.length<3){json.Goodo.R[1]=json.Goodo.R[0];json.Goodo.R[2]=json.Goodo.R[0];}
		$("label").eq(0).text(json.Goodo.R[0].AreaName)
		$("label").eq(1).text(json.Goodo.R[1].AreaName)
		$("label").eq(2).text(json.Goodo.R[2].AreaName)
	},
//	jsonpCallback: 'success_jsonpCallback'
});


 
$(function () {
	$(".login").click(function () {                         /////登录
		alert('login');
		$user = $("#user").val();
		$pass = $("#pass").val();

		layer.msg('正在登陆');
		$.ajax({
			url: API.baseUrl + '/BasePlate/Interface/IInterfaceJson.asmx/LoginUser',
			type: "post",
			dataType: "json",
			data: {
				LoginID: $user,
				EncyptPassword: $pass,
				OnlineType: 1,
				DeviceName: 'web test',
				Place: 'cs'
			},
			success: function (json) {
				console.log(json)
				console.log(json.Goodo.UserName);

				layer.closeAll();

				Cookies.set("yxtUser", json.Goodo);

				if (json.Goodo.UserName) {
					location.href = 'index.html';
				} else {
					layer.msg('用户名或者密码错');
				}
			}
		});
	});
})

